{% set apache_binary = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
{% set apache_conf_dir = 'apache2/conf-enabled' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd/conf.d' %}
{% set command = ('/usr/sbin/' + apache_binary + ' -DFOREGROUND') if heat_wsgi_provider == 'apache' else 'uwsgi /etc/heat/heat-api-cfn-uwsgi.ini' %}
{
    "command": "{{ command }}",
    "config_files": [
        {
            "source": "{{ container_config_directory }}/heat.conf",
            "dest": "/etc/heat/heat.conf",
            "owner": "heat",
            "perm": "0600"
        }{% if heat_wsgi_provider == 'apache' %},
        {
            "source": "{{ container_config_directory }}/wsgi-heat-api-cfn.conf",
            "dest": "/etc/{{ apache_conf_dir }}/wsgi-heat-api-cfn.conf",
            "owner": "heat",
            "perm": "0600"
        }{% elif heat_wsgi_provider == 'uwsgi' %},
        {
            "source": "{{ container_config_directory }}/heat-api-cfn-uwsgi.ini",
            "dest": "/etc/heat/heat-api-cfn-uwsgi.ini",
            "owner": "heat",
            "perm": "0600"
        }{% endif %}{% if heat_policy_file is defined %},
        {
            "source": "{{ container_config_directory }}/{{ heat_policy_file }}",
            "dest": "/etc/heat/{{ heat_policy_file }}",
            "owner": "heat",
            "perm": "0600"
        }{% endif %}{% if heat_enable_tls_backend | bool %},
        {
            "source": "{{ container_config_directory }}/heat-cert.pem",
            "dest": "/etc/heat/certs/heat-cert.pem",
            "owner": "heat",
            "perm": "0600"
        },
        {
            "source": "{{ container_config_directory }}/heat-key.pem",
            "dest": "/etc/heat/certs/heat-key.pem",
            "owner": "heat",
            "perm": "0600"
        }
        {% endif %}{% if kolla_copy_ca_into_containers | bool %},
        {
            "source": "{{ container_config_directory }}/ca-certificates",
            "dest": "/var/lib/kolla/share/ca-certificates",
            "owner": "root",
            "perm": "0600"
        }{% endif %}
    ],
    "permissions": [
        {
            "path": "/var/log/kolla/heat",
            "owner": "heat:heat",
            "recurse": true
        }
    ]
}
